<template>
  <div class="Count">
    <h3>Count</h3>
    <h3>当前的num的值是:{{$store.state.num}}</h3>
    <h3>当前的doubleNum值是:{{$store.getters.doubleNum}}</h3>
    <div>
      <button @click="$store.commit('increment')">累加num-原始操作</button>
      <button @click="increment">累加num-封装操作</button>
      <button @click="$store.commit('incrementN',{n:2})">累加N--num--原始操作</button>
      <button @click="incrementN({n:2})">累加N--num--封装方法操作</button>
    </div>
  </div>
</template>

<script>
import { mapMutations } from 'vuex';

export default {
    name:"Count",
    mounted(){
        console.log(this);
    },
    methods:{
      ...mapMutations(["increment","incrementN"])
    }
}
</script>

<style>
.Count{
    background-color:pink;
}
</style>